﻿GY.Bill.ConsultDetail = {
    CloseConsult: function () {
        var $this = $("#btnClose");
        $.ajax({
            type: "Post",
            url: $this.attr("data-url"),
            data: { id: $("#divMain").attr("data-billid") },
            dataType: "json",
            async: false,
            success: function (result) {
                if (result.code == 1) {
                    window.location.href = $(".back").attr("href");
                }
            }
        });
    }
};
(function () {
    $(function () {
        if (showTime.trim() == "") {
            var times = new GY.Bill.Common.CountDown(addTime, ".countdown .time");
        }

        $("#div_more").on("tap", function () {
            if ($(this).text() == "展开详情") {
                $(this).text("收起详情");
                $(".bill_write").show();
            } else {
                $(this).text("展开详情");
                $(".bill_write").hide();
            }
        });

        //弹窗
        $("#btnClose").on("tap", function () {
            ShowPopup("是否确认关闭当前询价？", "确认");
        });

        $("#btnSure").on("tap", function () {
            GY.Bill.ConsultDetail.CloseConsult();
        });

        //显示邀请信息
        $("#btn_invite_show").on("tap", function () {
            var billId = $("#divMain").attr("data-billid");
            GY.Bill.Common.LoadInvite(billId);

            $("#div_member_relation").addClass("simple");
            $("#div_member_relation .top1").show();
            $("#div_member_relation .top2").hide();
        });

        if (IsShowInvite != "1") {
            //是否直接弹出邀请
            switch (showInvite) {
            case 1:
                $("#btn_invite_show").trigger("tap");
                break;
            case 2:
                fnShade($(".shade"));
                $(".shade").show();
                $(".mask_wx_tip").show();
                break;
            }
        }

        $("#wx").on("tap", function () {
            fnShade($(".shade"));
            $(".shade").show();
            $(".mask_wx").show();
        });

        $(".shade").on("tap", function () {
            $(".shade").hide();
            $(".mask").hide();
        });
    });
})();

